set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)

include_directories(../libhello/include)

# 链接动态库
find_library(LIBHELLO NAMES hello PATHS "../libhello/lib")
message(STATUS "found libhello at " ${LIBHELLO})
target_link_libraries(main ${LIBHELLO})

# 如果要链接静态库:
#link_directories(${PROJECT_SOURCE_DIR}/libhello/lib)
# 并将 target_link_libraries(main hello) 改为
# target_link_libraries(main libhello.a)
# 这几条指令的顺序不能乱, 否则找不到库文件
add_executable(main main.c)
target_link_libraries(main hello)

